package com.financing.wap.service.impl;


import java.sql.SQLException;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import org.springframework.stereotype.Service;

import com.financing.wap.common.CommonConstantUtil.CommonStatus;
import com.financing.wap.dao.IDstUserIntegralFlowDao;
import com.financing.wap.dto.DstUserIntegralFlowDTO;
import com.financing.wap.service.IDstUserIntegralFlowService;
import com.financing.wap.util.DTOdateSetUtil;
/**
 * dst_user_integral_flow  
 * 用户积分流水表 业务访问层实现类
 * @author huqiyun
 *
 */
 
@Service("dstUserIntegralFlowService")
public class DstUserIntegralFlowServiceImpl implements IDstUserIntegralFlowService{

	@Autowired
	private IDstUserIntegralFlowDao dstUserIntegralFlowDao;

	@Override
	public int insert(DstUserIntegralFlowDTO dstUserIntegralFlow) throws SQLException {
		DTOdateSetUtil.setCreateInfo(dstUserIntegralFlow);
		DTOdateSetUtil.setUpdateInfo(dstUserIntegralFlow);
		dstUserIntegralFlow.setDeleteTag(CommonStatus.DELETE_TAG_NORMAL);
		return dstUserIntegralFlowDao.insert(dstUserIntegralFlow);
	}

	@Override
	public void update(DstUserIntegralFlowDTO dstUserIntegralFlow) throws SQLException {
		DTOdateSetUtil.setUpdateInfo(dstUserIntegralFlow);
		dstUserIntegralFlowDao.update(dstUserIntegralFlow);
	}

	@Override
	public void updateForce(DstUserIntegralFlowDTO dstUserIntegralFlow) throws SQLException {
		DTOdateSetUtil.setUpdateInfo(dstUserIntegralFlow);
		dstUserIntegralFlowDao.updateForce(dstUserIntegralFlow);
	}

	@Override
	public void delete(Integer id) throws SQLException {
		dstUserIntegralFlowDao.delete(id);
	}
	
	@Override
	public List<DstUserIntegralFlowDTO> queryList(DstUserIntegralFlowDTO dstUserIntegralFlow) throws SQLException {
		return dstUserIntegralFlowDao.queryList(dstUserIntegralFlow);
	}

	@Override
	public int queryListCount(DstUserIntegralFlowDTO dstUserIntegralFlow) throws SQLException {
		return dstUserIntegralFlowDao.queryListCount(dstUserIntegralFlow);
	}

	@Override
	public DstUserIntegralFlowDTO loadById(Integer id) throws SQLException {
		return dstUserIntegralFlowDao.loadById(id);
	}
 	@Override
	public DstUserIntegralFlowDTO queryListGetFirst(DstUserIntegralFlowDTO dstUserIntegralFlow)
			throws SQLException {
		 List<DstUserIntegralFlowDTO> queryList = queryList(dstUserIntegralFlow);
		 if(queryList==null||queryList.size()==0){
			 return new DstUserIntegralFlowDTO();
		 }
		 return queryList.get(0);
	}
}
